package com.hnevc.zz.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class RechargeDatabase extends SQLiteOpenHelper {
    private static final String SQLMoneyWord = "create table record(" +
            "_id integer primary key autoincrement," +
            "phone varchar(20)," +
            "money varchar(10)," +
            "date date);";
    //表二
    private static final String SQLFlowWord = "create table recordflow(" +
            "id integer primary key autoincrement," +
            "phone varchar(20)," +
            "flow varchar(10)," +
            "date date);";

    private RechargeDatabase( Context context) {
        super(context,"record.db", null, 1);
    }

    private static RechargeDatabase rechargeDatabase;
    public static  RechargeDatabase getInstance(Context context){
        if (rechargeDatabase==null){
            rechargeDatabase=new RechargeDatabase(context);
        }
        return rechargeDatabase;
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(SQLMoneyWord);
        db.execSQL(SQLFlowWord);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
//        db.execSQL("drop table record");
//        db.execSQL(SQLWord);
    }
}
